﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    
    <DataTemplate x:Key="AlarmListItem">
        <Border x:Name="MainBorder">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                            
                <Grid Grid.Row="0"
                      HorizontalAlignment="Left">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <Canvas Width="16"
                            Height="16"
                            Grid.Column="0"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Background="{StaticResource SmallTypeIconBrush}"
                            Margin="5,0,0,0"/>

                    <TextBlock Style="{StaticResource BigWhite}"
                                Foreground="{StaticResource DefaultForegroundDarkBrush}"
                                Text="Type:" 
                                Margin="5"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Center"
                                Grid.Column="1"/>

                    <TextBlock Style="{StaticResource BigWhite}"
                                Foreground="{StaticResource DefaultForegroundDarkBrush}"
                                Text="{Binding Path=Type}" 
                                Margin="0,5,5,5"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                Grid.Column="2"/>
                </Grid>
                            
                <StackPanel Orientation="Horizontal"
                            Grid.Row="1">

                    <Grid Grid.Row="1"
                          Margin="0,0,10,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <Canvas Width="16"
                                Height="16"
                                Grid.Column="0"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Background="{StaticResource SmallLevelIconBrush}"
                                Margin="5,0,0,0"/>
                        
                        <TextBlock Style="{StaticResource BigWhite}"
                                    Foreground="{StaticResource DefaultForegroundDarkBrush}"
                                    Text="Level:" 
                                    Margin="5"
                                    HorizontalAlignment="Right"
                                    VerticalAlignment="Center"
                                    Grid.Column="1"/>

                        <TextBlock Style="{StaticResource BigWhite}"
                                    Foreground="{StaticResource DefaultForegroundDarkBrush}"
                                    Text="{Binding Path=Level}" 
                                    Margin="0,5,5,5"
                                    HorizontalAlignment="Left"
                                    VerticalAlignment="Center"
                                    Grid.Column="2"/>
                    </Grid>

                    <Grid Grid.Row="1"
                          Margin="0,0,10,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <Canvas Width="16"
                                Height="16"
                                Grid.Column="0"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Background="{StaticResource SmallRunIconBrush}"
                                Margin="5,0,0,0"/>
                        
                        <TextBlock Style="{StaticResource BigWhite}"
                                    Foreground="{StaticResource DefaultForegroundDarkBrush}"
                                    Text="Action:" 
                                    Margin="5"
                                    HorizontalAlignment="Right"
                                    VerticalAlignment="Center"
                                    Grid.Column="1"/>

                        <TextBlock Style="{StaticResource BigWhite}"
                                    Foreground="{StaticResource DefaultForegroundDarkBrush}"
                                    Text="{Binding Path=Action}" 
                                    Margin="0,5,5,5"
                                    HorizontalAlignment="Left"
                                    VerticalAlignment="Center"
                                    Grid.Column="2"/>
                    </Grid>

                    <Grid Grid.Row="1" 
                          x:Name="WaitGrid"
                          Visibility="Collapsed"
                          Margin="0,0,10,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <Canvas Width="16"
                                Height="16"
                                Grid.Column="0"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Background="{StaticResource SmallClockIconBrush}"
                                Margin="5,0,0,0"/>
                        
                        <TextBlock Style="{StaticResource BigWhite}"
                                    Foreground="{StaticResource DefaultForegroundDarkBrush}"
                                    Text="Wait:" 
                                    Margin="5"
                                    HorizontalAlignment="Right"
                                    VerticalAlignment="Center"
                                    Grid.Column="1"/>

                        <TextBlock Style="{StaticResource BigWhite}"
                                    Foreground="{StaticResource DefaultForegroundDarkBrush}"
                                    Text="{Binding Path=WaitInterval}" 
                                    Margin="0,5,5,5"
                                    HorizontalAlignment="Left"
                                    VerticalAlignment="Center"
                                    Grid.Column="2"/>
                    </Grid>

                </StackPanel>
                            
            </Grid>
        </Border>

        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding Path=Action}" Value="CheckAfter">
                <Setter TargetName="WaitGrid" Property="Visibility" Value="Visible" />
            </DataTrigger>
        </DataTemplate.Triggers>

    </DataTemplate>
    
    <Style TargetType="{x:Type ListViewItem}" x:Key="AlarmItemContainerStyle">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListViewItem}">
                    <Border Background="Transparent"
                            BorderBrush="{StaticResource DefaultBackgroundBrush}"
                            BorderThickness="1"
                            Margin="0,5,0,5"
                            x:Name="MainBorder">
                        <ContentPresenter />
                    </Border>
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="MainBorder" Property="Background" Value="#E5F2F9" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                    
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>